package com.itheima.app.controller;

import com.itheima.app.interceptor.UserHolder;
import com.itheima.app.manager.AnnouncementManager;
import com.itheima.domain.vo.PageBeanVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AnnouncementController {

    @Autowired
    private AnnouncementManager announcementManager;

    @GetMapping("/messages/announcements")
    public PageBeanVo announcements(
            @RequestParam(defaultValue = "1") Integer page,
            @RequestParam(defaultValue = "10") Integer pagesize
    ){
        PageBeanVo pageBeanVo = announcementManager.announcements(page,pagesize);

        System.out.println(pageBeanVo);

        return pageBeanVo;
    }
}
